#!/usr/bin/env python
# -*- coding: utf-8 -*-


import time


#######################################################################

class   RowInterval(object) :
    def __init__(self, begin_row=None, end_row=None, begin_row_inclusive=True, end_row_inclusive=True) :
        self.begin_row = begin_row
        self.begin_row_inclusive = begin_row_inclusive
        self.end_row = end_row
        self.end_row_inclusive = end_row_inclusive
        # __init__()

    def __str__(self) :
        if self.begin_row_inclusive :
            left_brace = '['
        else :
            left_brace = '('
        if self.end_row_inclusive :
            right_brace = ']'
        else :
            right_brace = ')'

        _result = ''.join(('<', 'RowInterval', left_brace, `self.begin_row`, ' .. ', `self.end_row`, right_brace, '>'))
        return _result
        # __str__()

    # class RowInterval

class   TimeInterval(object) :
    time_begin = 0
    time_end   = int(time.time())
    # class TimeInterval

class   ScanSpec(object) :
    def __init__(self) :
        self.deletion_inclusive = False
        self.row_interval = None
        self.time_interval = TimeInterval()
        # __init__()

    def setRow(self, row_key) :
        ri = RowInterval(row_key, row_key)
        self.row_interval = ri
        # addRow()

    def setRowInterval(self, begin_row, end_row, begin_row_inclusive=True, end_row_inclusive=True) :
        if begin_row > end_row : begin_row, end_row = end_row, begin_row
        ri = RowInterval(begin_row, end_row, begin_row_inclusive, end_row_inclusive)
        self.row_interval = ri
        # addRowInterval()

    def setTimeInterval(self, time_begin, time_end) :
        if time_begin > time_end :
            time_begin,time_end = time_end,time_begin
        self.time_interval.time_begin = time_begin
        self.time_interval.time_end   = time_end
        # addTimeInterval()

    def __str__(self) :
        if self.row_interval :
            _ri = ' row[%s .. %s]' % (self.row_interval.begin_row, self.row_interval.end_row)
        else :
            _ri = ''
        if self.time_interval :
            _ti = ' time[%d .. %d]' % (self.time_interval.time_begin, self.time_interval.time_end)
        else :
            _ti = ''

        _result = ''.join(('<', 'ScanSpec', _ri, _ti, '>'))
        return _result
        # __str__

    # class ScanSpec



#######################################################################

class   ScanContext(object) :
    scan_spec = None

    # class ScanContext


#######################################################################
